Positioned element adding to total div height [migrated]

Posted by Max on Pro Webmasters See other posts from Pro Webmasters or by Max
Published on 2011-11-22T04:36:57Z Indexed on 2011/11/22 10:28 UTC
Read the original article Hit count: 108

Filed under:

I have a 800 x 600 rotatable image with forward and back buttons repositioned to the sides. The height of the div is suppose to be 600px, but the actual height of the div was pushed to 690, including the height of the button image. And the div was blocking a row of clickable menu on top. So I made the div height to 518px and moved top -75px to get the real dimension I want. But I feel dirty doing this... Is there a correct way to do this? Or is this workaround more or less correct? Below is the code. Thanks!

<div class="Content Wide" id="LayoutColumn1">
     <div style=" width: 980px; height: 518px; display: block; position: relative; float: left;">
          <a href="#" onClick="prev();"><img src="/template/img/next_button.png" style="position: relative; top: 200px; left: 5px; z-index: 2;"></a>
          <a href="/chef-special/" id="mainLink"><img src="/template/img/chef_special_large.png" id="main" style="margin: 0 0 0 50px; position: relative; float: left; top: -75px; z-index: 1;"></a>
          <a href="#" onClick="next();"><img src="/template/img/next_button.png" style="position: relative; top: 200px; left: 787px; z-index: 2;"></a>
     </div>
</div>

© Pro Webmasters or respective owner

Related posts about css